      SUBROUTINE TGLOC00A(KTYPE,NPARMS,KTIME,KPOS,KVEL,KATT,KTOP,ATT,
     *              KSYS,KORIGIN, LUERR,IERR)
      IMPLICIT REAL*8 (A-H,O-Z)
C
C THIS ROUTINE IS PART OF THE TOSS TARGET LOCATION PACKAGE, TGLOC.
C
C THIS ROUTINE CHECKS FOR ERRORS IN CERTAIN PARAMETERS INPUT TO THE
C TARGET LOCATION PACKAGE'S INTERFACE ROUTINE, TGLOC, BY IT'S CALLER.
C
C VAR     DIM    TYPE   I/O  DESCRIPTION
C ---     ---    ----   ---  -----------
C
C -->> ARGUMENTS HAVE THE SAME DESCRIPTION AS IN TGLOC00.
C
C***********************************************************************
C
C BY C PETRUZZO, GSFC/470, 10/83, 8/85
C     MODIFIED....
C
C***********************************************************************
C
      PARAMETER MAXTYPES= 8   ! MAX NUMBER OF DATA TYPES RECOGNIZED.
      INTEGER NEEDPARMS(MAXTYPES)/ 0,4,2,2, 0,3,-999,0 /
      LOGICAL NEEDTIME,NEEDATT,NEEDPOS,NEEDVEL,NEEDTOP
C
      IERR=0
C
      IF(KTYPE.LT.1 .OR. KTYPE.GT.MAXTYPES) THEN
        IERR=1
        IF(LUERR.GT.0) WRITE(LUERR,100) KTYPE
        GO TO 9999
        END IF
C
C  SET INTERNAL FLAGS FLAGS INDICATING NEED FOR TIME, POS, ETC.
C
      CALL TGLOCNEED(2,1,KTYPE, JTIME,JPOS,JVEL,JATT,JTOP,ATT,
     *       KSYS,KORIGIN, 0,IERR1)
C
      NEEDTIME = JTIME.NE.0
      NEEDPOS  = JPOS.NE.0
      NEEDVEL  = JVEL.NE.0
      NEEDATT  = JATT.NE.0
      NEEDTOP  = JTOP.NE.0
C
      IF(NEEDTIME) THEN
        IF(KTIME.EQ.0) THEN
          IERR = 1
          IF(LUERR.GT.0) WRITE(LUERR,200) 'TIME',KTYPE
          END IF
        END IF
C
      IF(NEEDPOS) THEN
        IF(KPOS.EQ.0) THEN
          IERR = 1
          IF(LUERR.GT.0) WRITE(LUERR,200) 'POSITION',KTYPE
          END IF
        END IF
C
      IF(NEEDVEL) THEN
        IF(KVEL.EQ.0) THEN
          IERR = 1
          IF(LUERR.GT.0) WRITE(LUERR,200) 'VELOCITY',KTYPE
          END IF
        END IF
C
      IF(NEEDATT) THEN
        IF(KATT.EQ.0) THEN
          IERR = 1
          IF(LUERR.GT.0) WRITE(LUERR,200) 'ATTITUDE',KTYPE
          END IF
        END IF
C
      IF(NEEDTOP) THEN
        IF(KTOP.EQ.0) THEN
          IERR = 1
          IF(LUERR.GT.0) WRITE(LUERR,200) 'TOPOCENTRIC',KTYPE
          END IF
        END IF
C
C VERIFY THAT THERE ARE ENOUGH PARAMETER SPACES IN THE PARMS ARRAY FOR
C THE INFO THAT IS SUPPOSED TO BE PRESENT. THIS CHECKS FOR ENOUGH ARRAY
C LOCATIONS, NOT FOR VALID CONTENTS. TARGET TYPE 7 IS CHECKED IN TGLOC07
C BECAUSE THE NUMBER NEEDED MAY VARY.
C
      IF(NPARMS.LT.NEEDPARMS(KTYPE)) THEN
        IERR = 1
        IF(LUERR.GT.0) WRITE(LUERR,300) KTYPE,NPARMS,NEEDPARMS(KTYPE)
        END IF
C
 9999 CONTINUE
      RETURN
  100 FORMAT(/,' TGLOC(TGLOC00A). ERROR. ',
     *              'INVALID TARGET TYPE ENTERED. VALUE=',I5/)
  200 FORMAT(/,
     *  ' TGLOC(TGLOC00A) ERROR. ',
     *     A,' DATA NEEDED BUT NOT SUPPLIED.  TARGET TYPE = ',I3)
  300 FORMAT(/,
     *  ' TGLOC(TGLOC00A) ERROR. INSUFFICIENT PARAMETERS(IN PARMS) FOR',
     *            'THIS TARGET TYPE.'/,
     *  '   TARGET TYPE=',I5,' NPARMS=',I5,' NUMBER NEEDED=',I5)
      END
